<template>
  <div>
    <el-form label-width="120px" :model="form">
      <el-form-item label="会员卡名称">
        <el-input v-model="form.name" size="small"></el-input>
      </el-form-item>
      <el-form-item label="会员提示">
        <el-input v-model="form.tip" size="small">
          <template slot="append">
            <el-button type="primary" size="small" @click="geo">定位</el-button>
          </template>
        </el-input>
      </el-form-item>
      <el-form-item label="会员有效天数">
        <el-input-number v-model="form.day" size="small"></el-input-number>
      </el-form-item>
      <el-form-item label="会员价格">
        <el-input v-model="form.money" maxlength="20" size="small"></el-input>
      </el-form-item>
      <el-form-item label="探店数量">
        <el-input-number v-model="form.signNum" maxlength="20" size="small"></el-input-number>
      </el-form-item>
      <el-form-item label="打卡游数量">
        <el-input-number v-model="form.topicNum" maxlength="20" size="small"></el-input-number>
      </el-form-item>
      <el-form-item label="会员权益" prop="note" key="note">
        <el-input type="textarea" v-model="form.note1" key="note1" size="small">
        </el-input>
      </el-form-item>
      <el-form-item label="非会员权益" prop="chatSign" key="chatSign">
        <el-input type="textarea" v-model="form.note2" key="note2" size="small">
        </el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="handleData" size="small">保存信息</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>

export default {
  data() {
    return {
      form: {
        tip:"",
        signNum:"",
        topicNum:""
      },
      rules: {
        name: [{
          required: true,
          message: "请输入名称",
          trigger: "blur"
        }],
      },
    };
  },
  methods: {
    async handleData() {
      var self = this;
      var param = this.form;
      var res = await this.$http.form("/config/configVip", param );
      if (res.code == 200) {
        self.$message({
          message: "更新成功",
          type: "success",
        });
      } else {
        self.$message.error(res.msg);
      }
    },
    async loadData() {
      const res = await this.$http.form("/config/vipInfo", {});
      if (res.code === 200) {
        this.form = res.data;
      }
    },
    changePoi(event) {
      console.log(event);
      this.form.lat = event.lat;
      this.form.lng = event.lng;
    },
  },
  mounted() {
    this.loadData();
  },
};
</script>

<style>
</style>
